/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.information.service.impl;

import com.kmcsoft.goldshop.information.service.InformationService;
import com.kmcsoft.goldshop.model.master.Currency;
import com.kmcsoft.goldshop.model.master.JewelryInformation;
import com.kmcsoft.goldshop.model.master.PawnInformation;
import com.kmcsoft.master.defaultservice.DefaultGenericService;
import java.util.Collection;

/**
 *
 * @author kmcsoft02
 */
public class JdoInformationService extends DefaultGenericService implements InformationService {

    public JewelryInformation getJewelryInformationById(Object id) {
        getPersistenceManager().getFetchPlan().addGroup("detach_JewelryInformation_All");
        getPersistenceManager().getFetchPlan().setMaxFetchDepth(-1);
        return getJdoTemplate().detachCopy(getJdoTemplate().getObjectById(JewelryInformation.class, id));
    }

    public Collection<Currency> getCurrencies() {
        return getJdoTemplate().detachCopyAll(getJdoTemplate().find(Currency.class, "using==true"));
    }

    public PawnInformation getPawnInformationById(Object id) {
        getPersistenceManager().getFetchPlan().addGroup("detach_PawnInformation_All");
        getPersistenceManager().getFetchPlan().setMaxFetchDepth(-1);
        return getJdoTemplate().detachCopy(getJdoTemplate().getObjectById(PawnInformation.class, id));
    }
}
